﻿#include "chartconfig.h"
#include <QtDebug>
#include <QtCore/QtCore>

ChartConfig::ChartConfig(QString configFileName)
{
    if(m_configFileName.isEmpty())
    {

        m_configFileName = QCoreApplication::applicationDirPath() + "/Config.ini";

    }else {

        m_configFileName = configFileName;
    }

    m_chartSettings = new QSettings(m_configFileName, QSettings::IniFormat);


}

ChartConfig::~ChartConfig()
{
    delete  m_chartSettings;

}

void ChartConfig::setConfig(QString &tag, QVariant &value)
{
    m_chartSettings->setValue(tag, value);
}

QVariant ChartConfig::GetConfig(QString &tag)
{
    return m_chartSettings->value(tag);
}

void ChartConfig::chartConfigInit()
{
    m_chartSettings->setValue("OpenGL",true);
    m_chartSettings->setValue("Resolution", "800*600");
    m_chartSettings->setValue("MaxTip",5);
    m_chartSettings->setValue("MaxXaxis",5);
    m_chartSettings->setValue("MaxYaxis",5);
    m_chartSettings->setValue("Theme",0);
}
